﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Work06._01
{
    class Student : IComparable
    {
        public string stuNO { get; set; }
        public string stuName { get; set; }
        public string age { get; set; }
        public Student(string stuNO, string stuName, string age)
        {
            this.stuNO = stuNO;
            this.stuName = stuName;
            this.age = age;
        }
        public override string ToString()
        {
            return $"学号：{stuNO}，姓名：{stuName}，年龄：{age}";
        }

        public int CompareTo(object obj)
        {
            if (obj is Student)
            {
                return this.age.CompareTo(((Student)obj).age);
            }
            else
            {
                throw new Exception("搞错了，不是Student。");
            }
        }
    }
}
